"use strict";
cc._RF.push(module, '4b2f8Ye4q9ATaVyNNfBE1cS', 'Warehouse');
// Script/Warehouse.js

"use strict";

cc.Class({
  "extends": cc.Component,
  properties: {
    showTimes: 1,
    //隐藏时间
    jumpHeight: 100,
    //跳跃高度
    _isShow: false
  },
  onConfirBtn: function onConfirBtn(callback) {
    var children = this.node.children;
    isShow = 0;

    for (var i = 0; i < children.length; ++i) {
      //   cc.log("Node: " + children[i].name);
      children[i].on('click', function (event) {
        if (event.name == 'd1<Button>') {
          cc.log('b1');
        }

        if (event.name == 'd2<Button>') {
          cc.log('b2');
        }

        if (event.name == 'd3<Button>') {
          cc.log('b3');
        }

        if (event.name == 'd4<Button>') {
          cc.log('b4');
        } //获取数据


        var sendData = {
          "TaskGuid": "slkdjflie09876",
          "DataType": "gameset",
          "user_id": "1",
          "set_code": "1",
          "status": "1"
        }; //获取网络数据

        var xhr = new XMLHttpRequest();

        xhr.onreadystatechange = function () {
          if (xhr.readyState == 4 && xhr.status >= 200 && xhr.status < 400) {
            var response = xhr.responseText;
            console.log(response); //console.log("==============");	

            var info = eval('(' + response + ')');
            var infores = eval('(' + info + ')'); //设置步骤

            stepstatus = 0;
            console.log(infores);
          }
        }; // xhr.open("GET", seturl+'/'+JSON.stringify(sendData), true);


        xhr.open("GET", seturl + JSON.stringify(sendData), true);
        xhr.send(); //				cc.log('点击了按钮'+event.name);

        if (typeof callback === "function") {
          callback('1');
        } else {
          cc.log(callback);
        }
      }, this);
    }

    this.finish(); //先销毁自己
  },
  setShowClose: function setShowClose(boo) {
    if (boo == false) {
      this.node.getChildByName("closeBtn").active = false;
    } else {//什么都不用做
    }
  },
  // LIFE-CYCLE CALLBACKS:
  onLoad: function onLoad() {
    //cc.log("warehourse.onLoad")
    window.showtips = this; // 初始化计时器

    this.timer = 0;
    this.node.active = true;
    this.node.getChildByName("closeBtn").on('touchend', function (event) {
      this.finish();
    }, this);
  },
  setJumpAction: function setJumpAction() {
    this.timer = 0; // 跳跃

    var jumpDown = cc.moveBy(this.showTimes, cc.v2(0, this.jumpHeight)).easing(cc.easeCubicActionIn());
    var callback = cc.callFunc(this.finish, this);
    return cc.repeat(cc.sequence(jumpDown, callback), 1);
  },
  finish: function finish() {
    isShow = 0;
    this._isShow = false;

    if (this.node) {
      this.node.active = this._isShow;
    }

    this.node.stopAllActions();
    this.node.destroy();
  },
  start: function start() {} // update (dt) {},

});

cc._RF.pop();